function pay2() {
	var appId = jQuery('#appId').val();
	var timeStamp = jQuery('#timeStamp').val();
	var nonceStr = jQuery('#nonceStr').val();
	var signType = jQuery('#signType').val();
	var pk = jQuery('#package').val();
	var paySign = jQuery('#paySign').val();
	if (typeof WeixinJSBridge == "undefined") {
		if (document.addEventListener) {
			document.addEventListener('WeixinJSBridgeReady', onBridgeReady,
					false);
		} else if (document.attachEvent) {
			document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
			document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
		}
	} else {
		onBridgeReady();
	}
	function onBridgeReady() {
		console.log(appId + "==" + timeStamp + "==" + nonceStr + "==" + pk
				+ "==" + "MD5" + "==" + paySign + "")
		WeixinJSBridge
				.invoke(
						'getBrandWCPayRequest',
						{
							"appId" : appId,// 公众号名称，由商户传入
							"timeStamp" : timeStamp, // 时间戳，自1970年以来的秒数
							"nonceStr" : nonceStr, // 随机串
							"package" : pk,
							"signType" : "MD5", // 微信签名方式：
							"paySign" : paySign
						// 微信签名
						},
						function(res) {
							if (res.err_msg == "get_brand_wcpay_request:ok") {
								success();
							}
							// 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
							else {
								window.location.href = "${pageContext.request.contextPath}/mobile/user/payfail/"
							}
						});
	}
}
function success() {
	alert("ok");
	// jQuery
	// .ajax({
	// url : "${pageContext.request.contextPath}/mobile/user/paysuccess/",
	// datatype : 'json',
	// type : "Post",
	// scriptCharset : 'utf-8',
	// contentType : "application/x-www-form-urlencoded; charset=utf-8",
	// success : function(data) {
	// window.location.href =
	// "${pageContext.request.contextPath}/mobile/user/success2"
	// }
	// })
}

{  "goods_detail":[
	     {
	    "goods_id":"iphone6s_16G",
	    "wxpay_goods_id":"1001",
	    "goods_name":"iPhone6s 16G",
	    "goods_num":1,
	    "price":528800,
	    "goods_category":"123456",
	    "body":"苹果手机"
	    },
	    {
	    "goods_id":"iphone6s_32G",
	    "wxpay_goods_id":"1002",
	    "goods_name":"iPhone6s 32G",
	    "quantity":1,
	    "price":608800,
	    "goods_category":"123789",
	    "body":"苹果手机"
	    }
	    ]
	    }
